package com.quanxi.qxaimain;

/**
 * @Author lyx
 * @create 2022/10/8 15:08
 */
class A extends Thread {
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("this is class A method");
    }
}
class B {
    public void methodB() {
        A a = new A();
        a.start();
        System.out.println("this is class B method");
    }
}

public class Main {
    public static void main(String[] args) {
        B b = new B();
        b.methodB();//虽然A先执行，但由于等待3s导致先输出B，再输出A

        System.out.println(System.getProperty("User.dir"));
    }
}
